package day03;

public class OperDemo1 {
    public static void main(String[] args) {
        //1)算数运算符: +、-、*、\、%、++、--  //sout回车
       /* System.out.println(5%2);//1，商2余1
        System.out.println(8%2);//0,商4余0----整除
        System.out.println(2%8);//2，商0余2*/
        //单独用----自增
        /*int a=5,b=5;
        a++;//相当于a=a+1
        ++b;//相当于b=b+1
        System.out.println(a);//6
        System.out.println(b);//6*/

        //单独用----自减
        /*int a=5,b=5;
        a--;//相当于a=a-1
        --b;//相当于b=b+1
        System.out.println(a);//4
        System.out.println(b);//4*/

        /*//被使用----自增
        int a=5,b=5;
        int c = a++;//1)将a++的值5赋值给c  2)a自增为1变为6
        int d = ++b;//1)将++b的值6赋值给c  2)a自增为1变为6
        System.out.println(a);//6
        System.out.println(b);//6
        System.out.println(c);//5
        System.out.println(d);//6*/

        //被使用----自减
        int a=5,b=5;
        int c = a--;//1)将a--的值5赋值给c  2)a自减为1变为4
        int d = --b;//1)将--b的值4赋值给c  2)a自减为1变为4
        System.out.println(a);//4
        System.out.println(b);//4
        System.out.println(c);//5
        System.out.println(d);//4
    }
}
